﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace FormApp
{
    internal class TestDll
    {
        private const string _dllName = "TestDll.dll";

        [StructLayout(LayoutKind.Sequential)]
        public struct DemoStruct
        {
            public int Num;
            public float Float;
            public double Double;
        }

        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public static extern void Init();

        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public extern static void StructClear();
        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public extern static void StructAdd(DemoStruct value);
        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public extern static void StructAdds(DemoStruct[] value, int len);
        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public extern static void StructRead(int id, ref DemoStruct value);
        [DllImport(_dllName, CallingConvention = CallingConvention.Cdecl)]
        public extern static void StructReads(ref int ids, int len, ref DemoStruct value);
    }
}
